﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserManage.aspx.cs" Inherits="RichECMS.ServerPages.User.UserManage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../../sysCommon/sysStyle/Pages.css" type="text/css" rel="stylesheet" />
    <link href="../../sysCommon/sysStyle/style.css" type="text/css" rel="stylesheet" />
    <link href="../../sysCommon/sysScripts/ztree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet"
        type="text/css" />
    <link href="../../sysCommon/sysScripts/ztree/css/Filetree.css" rel="stylesheet" type="text/css" />
    <script src="../../sysCommon/sysScripts/jquery/1.7.2/Jquery.js" type="text/javascript"></script>
    <script src="../../sysCommon/sysScripts/ztree/js/jquery.ztree.all-3.3.min.js" type="text/javascript"></script>
    <script src="../../sysCommon/sysScripts/cboxCheckAll.js" type="text/javascript"></script>
    <script src="../../sysCommon/sysScripts/parent1.js" type="text/javascript"></script>
    <script src="../../sysCommon/sysScripts/commompage.js" type="text/javascript"></script>
    <style type="text/css">
        .articleinfotable
        {
            display: none;
        }
        .articleinfo
        {
            height: 44px;
            width: 100%;
        }
        .articleinfo div
        {
            margin: 2px 40px 2px 40px;
            overflow: auto;
            height: 40px;
            color: #46594f;
        }
        .page div.sabrosus a
        {
            height: 15px;
            line-height: 15px;
            overflow: hidden;
        }
        a.AddSection
        {
            color: #3e5744;
            font-size: 12px;
        }
        img
        {
            margin-right: 0px;
        }
        a, td, tr
        {
            font-size: 12px;
            color: #033d61;
        }
        a:link
        {
            text-decoration: none;
            color: #033d61;
        }
        a:active
        {
            text-decoration: #033d61;
        }
        a:hover
        {
            text-decoration: underline;
            color: #033d61;
        }
        a:visited
        {
            text-decoration: none;
            color: #033d61;
        }
        body
        {
            margin-left: 0px;
            margin-top: 0px;
            margin-right: 0px;
            margin-bottom: 0px;
            background-color: #F1F1F1;
        }
        #UserWebTreen0Nodes table td:last-child
        {
            width: 80px;
        }
        .sectioninput
        {
            width: 200px;
        }
    </style>
    <script type="text/javascript">
		<!--
        var setting = {
            check: {
				enable: true
				//chkboxType: {"Y":"Ps", "N":"Ps"}
			},
            view: {
				selectedMulti: false
			},
            data: {
                simpleData: {
                    enable: true
                }
            },
            callback: {
                beforeClick: beforeClick,
                onCheck: onCheck
            }
        };

         var setting2 = {
            data: {
                simpleData: {
                    enable: true
                }
            }
        };

        var zNodes = <% =BuildSectionTree() %>;
        var zNodes2source = [<% =strPermissionsText %>];
        var zNodes2=zNodes2source;

        function beforeClick(treeId, treeNode) {
			var zTree = $.fn.zTree.getZTreeObj("treeSection");
			zTree.checkNode(treeNode, !treeNode.checked, null, true);
			return false;
		}

        var zTree;

        function onCheck(e, treeId, treeNode) {
                //轮询所有选中的根节点
                zTree = $.fn.zTree.getZTreeObj("treeSection");
                var nodes = zTree.getNodes();
			    var v = "",
                vhidden="";
                
                for (var i=0;i<nodes.length; i++) {
                    if(nodes[i].checked==true)
                    {
                           v+=buildNodes(nodes[i])+",";
                           vhidden+=buildNodesSid(nodes[i]);
                    }
			    }
                 if (v.length > 0 ) v = v.substring(0, v.length-1);
			     $("#selectSectionvalue").val(v);
                 if (vhidden.length > 0 ) vhidden = vhidden.substring(0, vhidden.length-1);
                  $("#sectionCurrentSelect").val(vhidden);
                 var tempodes=jQuery.parseJSON("["+v+"]");
                
                 $.fn.zTree.init($("#selectTreeSelected"), setting2, tempodes);
        }
        
        function buildNodes(currentnode) {
            if(currentnode.checked!=true)
            {
                return "";
            }
            var tempnode = "{";
            var tempone='"name":'+'"'+currentnode.name+'",';

            if(currentnode.children!=null)
            {
                if(currentnode.children.length>0)
                {
                    var tt="";
                    for(var i=0;i<currentnode.children.length;i++)
                    {
                        if(currentnode.children[i].checked==true)
                        {
                             tt+=buildNodes(currentnode.children[i])+",";
                        }
                    }
                    if (tt.length > 0 ) tt = tt.substring(0, tt.length-1);
                   tempone+='"children":['+tt+'],';
                }
            }

            tempone+='"isParent":'+currentnode.isParent+',';
            tempone+='"open":'+currentnode.open+',';
            tempone+='"lifetype":'+'"'+currentnode.lifetype+'",';
           
             tempone+='"sid":'+'"'+currentnode.sid+'"';
             tempnode +=tempone+ "}";

             return tempnode;
        }

         function buildNodesSid(currentnode) {
            if(currentnode.checked!=true)
            {
                return "";
            }
            var tempsid = currentnode.sid+",";
            if(currentnode.children!=null)
            {
                if(currentnode.children.length>0)
                {
                    var tt="";
                    for(var i=0;i<currentnode.children.length;i++)
                    {
                        if(currentnode.children[i].checked==true)
                        {
                             tt+=buildNodesSid(currentnode.children[i]);
                        }
                    }
                   tempsid+=tt;
                }
            }

             return tempsid;
        }

        function updateNode(newNodes) {
			var zTree = $.fn.zTree.getZTreeObj("selectTreeSelected"),
			nodes = newNodes;console.dir(zTree);
			if (nodes.length == 0) {
				alert("请先选择栏目");
			}
			for (var i=0, l=nodes.length; i<l; i++) {
				zTree.updateNode(nodes[i]);
			}
		}

        function showMenu() {
			var cityObj = $("#selectSection");
			var cityOffset = $("#selectSection").offset();
			$("#menuContent").css({left:cityOffset.left + "px", top:cityOffset.top + cityObj.outerHeight() + "px"}).slideDown("fast");
			$("body").bind("mousedown", onBodyDown);
		}
		function hideMenu() {
			$("#menuContent").fadeOut("fast");
			$("body").unbind("mousedown", onBodyDown);
		}
		function onBodyDown(event) {
			if (!(event.target.id == "menuBtn" || event.target.id == "selectSection" || event.target.id == "menuContent" || $(event.target).parents("#menuContent").length>0)) {
				hideMenu();
			}
		}

        $(document).ready(function () {
        //判断ie浏览器
            if(!+[1,])
            {
                var pIeJs=document.createElement("script"); 
                pIeJs.src='../../sysCommon/sysScripts/lib/json2.js';
                document.appendChild(pIeJs);
            };

            $.fn.zTree.init($("#treeSection"), setting, zNodes);
            $.fn.zTree.init($("#selectTreeSelected"), setting2, zNodes2);
        });
		//-->
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="main_body">
        <div class="right_body">
            <div class="right_top">
                <a href="#">CMS内容管理平台</a>><span style="color: #417DB7">账户管理</span></div>
            <div class="title">
                <div class="information">
                    账户管理</div>
            </div>
            <div class="premi_box">
                <table border="0" align="left" cellpadding="0" cellspacing="0" style="width: 100%">
                    <tr>
                        <td align="left" width="200" valign="top">
                            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td align="left" valign="top">
                                        <img src="../../sysCommon/sysImages/systerm/account_list_title.jpg" width="200" height="28" />
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left" valign="top" style="padding: 10px;" background="../../sysCommon/sysImages/systerm/account_list_bg.jpg">
                                        <div style="color: #6A544A; font-size: 12px;">
                                            当前管理员信息：
                                            <asp:LinkButton ID="LinkButtonAddUser" runat="server" CssClass="AddSection" OnClick="LinkButtonAddUser_Click">添加管理员</asp:LinkButton>
                                        </div>
                                        <div class="treebox">
                                            <asp:TreeView ID="UserWebTree" runat="server">
                                            </asp:TreeView>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left" valign="top">
                                        <img src="../../sysCommon/sysImages/systerm/account_list_bottom.jpg" width="200"
                                            height="10" />
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td align="left" style="padding-left: 10px;" valign="top">
                            <table width="674" border="0" align="left" cellpadding="0" cellspacing="0" style="border: #ddd solid 1px;"
                                bgcolor="#FFFFFF">
                                <tr>
                                    <td align="left" valign="top" background="../../sysCommon/sysImages/systerm/manage_title_bg.jpg">
                                        <img src="../../sysCommon/sysImages/systerm/mange_title.jpg" width="100" height="27" />
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left" valign="top" style="padding-left: 20px; padding-bottom: 24px; padding-top: 15px;">
                                        <table width="530" border="0" align="left" cellpadding="0" cellspacing="0">
                                            <tr>
                                                <td align="right" valign="middle" width="80" height="30">
                                                    登录用户名：
                                                </td>
                                                <td>
                                                    <label for="textfield">
                                                    </label>
                                                    <asp:TextBox ID="txtUserLoginID" runat="server"></asp:TextBox>
                                                    <asp:HiddenField ID="HIddenUserID" runat="server" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" valign="middle" width="80" height="30">
                                                    真实用户名：
                                                </td>
                                                <td>
                                                    <label for="textfield">
                                                    </label>
                                                    <asp:TextBox ID="txtUserName" runat="server"></asp:TextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" valign="middle" width="80" height="30">
                                                    登录密码：
                                                </td>
                                                <td>
                                                    <label for="textfield">
                                                    </label>
                                                    <asp:TextBox ID="txtUserPSD" runat="server" TextMode="Password"></asp:TextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" valign="middle" width="80" height="30">
                                                    确认密码：
                                                </td>
                                                <td>
                                                    <label for="textfield">
                                                    </label>
                                                    <asp:TextBox ID="txtUserRePSD" runat="server" TextMode="Password"></asp:TextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" valign="middle" width="80" height="30">
                                                    是否启用：
                                                </td>
                                                <td>
                                                    <label for="textfield">
                                                    </label>
                                                    <asp:CheckBox ID="CKboxEnabled" runat="server" Checked="true" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" valign="middle" width="80" height="30">
                                                    设置权限：
                                                </td>
                                                <td>
                                                    <label for="select">
                                                    </label>
                                                    <asp:RadioButton ID="RbtnDesigner" runat="server" Text="设计者" Visible="false" GroupName="Competence" />
                                                    <asp:RadioButton ID="RbtnAdmin" runat="server" Text="管理者" Visible="false" GroupName="Competence" />
                                                    <asp:RadioButton ID="UserCanIssueAndClients" runat="server" Text="用户（发布整站,管理注册,管理栏目）"
                                                        Visible="false" GroupName="Competence" />
                                                    <asp:RadioButton ID="UserCanIssue" runat="server" Text="用户（发布整站）" Visible="false"
                                                        GroupName="Competence" />
                                                    <asp:RadioButton ID="RbtnUser" runat="server" Text="用户（普通）" Checked="true" Visible="false"
                                                        GroupName="Competence" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" valign="top" width="80" height="180">
                                                    网站栏目：
                                                </td>
                                                <td valign="top">
                                                    <div class="zTreeDemoBackground left">
                                                        <input id="selectSection" type="text" class="sectioninput" readonly="readonly" value=""
                                                            onclick="showMenu();" /><a id="menuBtn" href="#" onclick="showMenu(); return false;">选择栏目</a>
                                                        <br />
                                                        <div style="height: 190px; width: 190px; margin: 5px 0px 5px 0px; overflow-x: hidden;
                                                            overflow-y: auto; background-color: #fff;">
                                                            <ul id="selectTreeSelected" class="ztree" style="margin-top: 0; width: 190px; height: 180px;">
                                                            </ul>
                                                        </div>
                                                        <textarea id="selectSectionvalue" runat="server" name="selectSectionvalue" style="display: none;">
                                                        </textarea>
                                                        <asp:HiddenField ID="sectionCurrentSelect" runat="server" />
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    &nbsp;
                                                </td>
                                                <td align="left" valign="middle" height="35">
                                                    <asp:ImageButton ID="ImageButtonAdd" ImageUrl="../../sysCommon/sysImages/systerm/set_menu_1.jpg"
                                                        runat="server" Width="71" Height="22" AlternateText="添加" Visible="false" OnClick="ImageButtonAdd_Click" />
                                                    <asp:ImageButton ID="ImageButtonUpdate" ImageUrl="../../sysCommon/sysImages/systerm/set_menu_1.jpg"
                                                        runat="server" Width="71" Height="22" AlternateText="修改" Visible="false" OnClick="ImageButtonUpdate_Click" />
                                                    <a href="#">
                                                        <img src="../../sysCommon/sysImages/set_menu_2.jpg" alt="重置" width="71" height="22"
                                                            style="padding-left: 15px;" /></a>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
    <div id="menuContent" class="menuContent" style="display: none; position: absolute;
        overflow-y: auto; overflow-x: hidden; border: 1px solid #000; background-color: #F1F1F1;">
        <ul id="treeSection" class="ztree" style="margin-top: 0; width: 190px; height: 180px;">
        </ul>
    </div>
    </form>
</body>
</html>
